home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Taifun
/
Taifun 102 (1989-08-15)(Ossowski, Stefan)(DE)(PD).zip
/
Taifun 102 (1989-08-15)(Ossowski, Stefan)(DE)(PD).adf
/
Life_Research
/
Game of Life 2.0
< prev
next >
Wrap
Text File
|
1989-04-21
|
22KB
|
825 lines
CLEAR ,70000&: DEFINT a-y
DIM cs(7,999),sw(1,49,149),b$(4),item(1,15),a(2)
DATA 1,1,0,0,0,0,0,0,0,1,1,0,0,1,1
FOR n=0 TO 14
READ a
item(0,n)=a
item(1,n)=ABS(a-1)
NEXT n
nnbI=1:nnbII=1
SCREEN 1,640,250,2,2
WINDOW 9,"mem ",(556,92)-(631,236),20,1
GOSUB ColorReset
FOR n=0 TO 120 STEP 24
LINE (1,n+1)-(52,n+22),1,b
LOCATE INT(n/8)+2,9:PRINT CHR$(65+n/24)
NEXT n
WINDOW 8,"co-ordinates ",(0,212)-(132,236),16,1
PRINT "mode :"
PRINT " x :"
PRINT " y :";
WINDOW 10,"message ",(144,212)-(544,236),0,1
COLOR 2:PRINT "welcome to GAME OF LIFE";
MENU 1,0,1,"about"
MENU 1,1,1," "
MENU 1,2,1," Game Of Life Research Program "
MENU 1,3,1," "
MENU 1,4,1," Release 2.0 "
MENU 1,5,1," "
MENU 1,6,1," Oktober 1988 by Rainer Umbach "
MENU 1,7,1," "
MENU 2,0,1,"go ahead"
MENU 2,1,1,"normal simulation "
MENU 2,2,1,"single step simulation "
MENU 2,4,1,"suicide "
MENU 3,0,1,"mem`s"
MENU 3,1,1,"> a <"
MENU 3,2,1,"> b <"
MENU 3,3,1,"> c <"
MENU 3,4,1,"> d <"
MENU 3,5,1,"> e <"
MENU 3,6,1,"> f <"
MENU 3,7,1,"break"
MENU 4,0,1,"copy"
MENU 4,1,1,"memory into window "
MENU 4,2,1,"part of window to memory"
MENU 4,3,1,"buffer to memory "
MENU 4,4,1,"memory to buffer "
MENU 4,5,1,"memory to memory "
MENU 5,0,1,"logical operations"
MENU 5,1,1,"buffer AND memory"
MENU 5,2,1,"buffer OR memory"
MENU 5,3,1,"buffer XOR memory"
MENU 6,0,1,"edit"
MENU 6,1,1,"erase buffer "
MENU 6,2,1,"erase part of window"
MENU 6,3,1,"erase whole window "
MENU 6,4,1,"inverse buffer "
MENU 6,5,1,"grid off "
MENU 7,0,1,"disk"
MENU 7,1,1,"save memory"
MENU 7,2,1,"load memory"
MENU 7,3,1,"save window"
MENU 7,4,1,"load window"
MENU 7,5,1,"directory "
MENU ON
GOTO scs
ssm:
ON ERROR GOTO ssmFehler
WINDOW CLOSE 5
h$=SPACE$(50)
WINDOW 3,"structure simulation mode"+h$,(0,0)-(600,200),16,1
wi=3:GOSUB just:GOSUB setMENU
MENU 2,3,1,"structure construction set"
CALL ssmGitter
IF nnbII=0 THEN
wi=wi-3:a=0
FOR m=1 TO 200 STEP 4
b=0
FOR n=1 TO 600 STEP 4
IF sw(wi,a,b) THEN LINE (n,m)-(n+2,m+2),3,bf
b=b+1
NEXT n
a=a+1
NEXT m
wi=wi+3
END IF
mess=6:GOTO messageFresh
ssmRefresh:
WINDOW OUTPUT 8:LOCATE 1,8:COLOR 2:PRINT "ssm mouse"
WINDOW OUTPUT 3
CALL ssmMouse(x,y,c)
men=MENU(0)
meno=MENU(1)
IF men=2 THEN
ON meno GOTO ssmStartenI,ssmStartenII,scs,suicide
ELSEIF men=4 THEN
IF meno=1 THEN ssmSetzen
IF meno=2 THEN ssmLesen
IF meno=5 THEN Kopieren
ELSEIF men=6 THEN
IF meno=2 THEN ssmLoeschen
IF meno=3 THEN ssmErase
ELSEIF men=7 THEN
ON meno GOTO Sichern,Laden,ssmSichern,ssmLaden,Directory
END IF
GOTO ssmRefresh
ssmFehler:
CALL Fehleranzeige
WINDOW OUTPUT wi
RESUME ssmRefresh
ssmLoeschen:
WINDOW OUTPUT 10:COLOR 2:PRINT
PRINT "enter co-ordinates of area to erase, it`s a frame"
PRINT "use mouse pointer and left mouse botton"
PRINT "first top/left, then bottom/right";
WINDOW OUTPUT wi
GOSUB catchtheMouse
x1=x*4:y1=y*4:x3=x1:y3=y1
ssmLoeschenMarke:
CALL ssmMouse(x,y,c)
a=x*4:b=y*4
IF a>=x1 THEN x2=a:ELSE x2=x1
IF b>=y1 THEN y2=b:ELSE y2=y1
IF x2<>x3 OR y2<>y3 THEN
LINE (x1,y1)-(x3+4,y3+4),1,b
LINE (x1,y1)-(x2+4,y2+4),2,b:x3=x2:y3=y2
END IF
IF c<>0 THEN ssmLoeschenMarke
LINE (x1,y1)-(x2+4,y2+4),0,bf
LINE (0,0)-(600,200),1,b
CALL ssmGitter
x1=x1/4:x2=x2/4:y1=y1/4:y2=y2/4
FOR n=y1 TO y2
FOR m=x1 TO x2
sw(0,n,m)=0
sw(1,n,m)=0
NEXT m
NEXT n
mess=6:GOTO messageFresh
ssmErase:
GOSUB just
LINE (0,0)-(600,200),0,bf
CALL ssmGitter
FOR n=0 TO 49
FOR m=0 TO 149
sw(0,n,m)=0
sw(1,n,m)=0
NEXT m
NEXT n
nnbII=1:mess=6:GOTO messageFresh
ssmSichern:
y2=95:CALL PRGRequest(f$,df$,y2):IF f$="/" THEN ssmRefresh
GOSUB just
wi=wi-3
OPEN f$ FOR OUTPUT AS #1
FOR n=0 TO 49
FOR m=0 TO 149
WRITE#1,sw(wi,n,m)
NEXT m
NEXT n
CLOSE 1
wi=wi+3
mess=2:GOTO messageFresh
ssmLaden:
y2=95:CALL PRGRequest(f$,df$,y2):IF f$="/" THEN ssmRefresh
GOSUB just
OPEN f$ FOR INPUT AS #1
wi=wi-3:a=0
FOR m=1 TO 200 STEP 4
b=0
FOR n=1 TO 600 STEP 4
INPUT#1,c
IF c<>sw(wi,a,b) THEN LINE (n,m)-(n+2,m+2),c*3,bf
sw(0,a,b)=c:sw(1,a,b)=c
b=b+1
NEXT n
a=a+1
NEXT m
CLOSE
wi=wi+3
nnbII=0:mess=2:GOTO messageFresh
ssmStartenII:
smod=2
ssmStartenI:
ret=0:IF nnbII=1 THEN ssmSimulationsende
WINDOW OUTPUT 10:COLOR 2
IF smod=2 THEN PRINT:PRINT "any key continues after signal black-orange-black";
PRINT:PRINT "stop simulation with space";
WINDOW wi
GOSUB just
GOSUB ssmSimulationsinit
IF xr<xl THEN ssmSimulationsende
FOR n=0 TO 3
PALETTE n,.1,.1,1
NEXT
PALETTE 3,1,.55,0
us=0
ssmStartenMarke:
w=wi-3
IF wi=3 THEN wi=4:ELSE wi=3
yor=0:yur=0:xlr=0:xrr=0:yov=0:yuv=0:xlv=0:xrv=0:settest=0:a$=""
wi=wi-3
FOR n=yo TO yu
o=n-1:IF o=-1 THEN o=49
u=n+1:IF u=50 THEN u=0
FOR m=xl TO xr
l=m-1:IF l=-1 THEN l=149
r=m+1:IF r=150 THEN r=0
a=sw(w,o,l)+sw(w,o,r)+sw(w,u,l)+sw(w,u,r)
a=a+sw(w,o,m)+sw(w,u,m)+sw(w,n,l)+sw(w,n,r)
IF a<>2 THEN
IF a=3 THEN c=1:ELSE c=0
IF sw(w,n,m)<>c THEN
aa=m*4+1:bb=n*4+1:settest=1
LINE (aa,bb)-(aa+2,bb+2),c*3,bf
END IF
ELSE
c=sw(w,n,m)
END IF
sw(wi,n,m)=c
IF a$="" THEN a$=INKEY$
NEXT m
IF a$=" " THEN ret=1
NEXT n
IF (ret OR settest=0) AND wi=0 THEN GOTO ssmSimulationsende
FOR xx=xl TO xr
IF sw(wi,yo,xx) THEN yor=1
IF sw(wi,yu,xx) THEN yur=1
NEXT xx
FOR yy=yo TO yu
IF sw(wi,yy,xl) THEN xlr=1
IF sw(wi,yy,xr) THEN xrr=1
NEXT yy
yo=yo-yor:yu=yu+yur:xl=xl-xlr:xr=xr+xrr
FOR xx=xl+1 TO xr-1
IF sw(wi,yo+1,xx) THEN yov=1
IF sw(wi,yu-1,xx) THEN yuv=1
NEXT xx
FOR yy=yo+1 TO yu-1
IF sw(wi,yy,xl+1) THEN xlv=1
IF sw(wi,yy,xr-1) THEN xrv=1
NEXT yy
GOSUB SimulationstestI
IF us THEN
IF yo=2 THEN
FOR y=yo TO yu:FOR x=xl TO xr:IF sw(wi,y,x)=0 THEN NEXT:NEXT
yo=y-1:us=0
END IF
IF yu=48 THEN
FOR y=yu TO yo STEP -1:FOR x=xl TO xr:IF sw(wi,y,x)=0 THEN NEXT:NEXT
yu=y+1:us=0
END IF
IF xl=1 THEN
FOR x=xl TO xr:FOR y=yo TO yu:IF sw(wi,y,x)=0 THEN NEXT:NEXT
xl=x-1:us=0
END IF
IF xr=148 THEN
FOR x=xr TO xl STEP -1:FOR y=yo TO yu:IF sw(wi,y,x)=0 THEN NEXT:NEXT
xr=x+1:us=0
END IF
END IF
wi=wi+3
IF smod=2 AND ret=0 THEN GOSUB stepbystep
GOTO ssmStartenMarke
ssmSimulationsende:
GOSUB ColorReset
wi=3:smod=0:mess=4:GOTO messageFresh
ssmSimulationsinit:
wi=wi-3
FOR x=0 TO 149:FOR y=0 TO 49:IF sw(wi,y,x)=0 THEN NEXT:NEXT
xl=x-1
FOR y=0 TO 49:FOR x=0 TO 149:IF sw(wi,y,x)=0 THEN NEXT:NEXT
yo=y-1
FOR x=149 TO 0 STEP -1:FOR y=0 TO 49:IF sw(wi,y,x)=0 THEN NEXT:NEXT
xr=x+1
FOR y=49 TO 0 STEP -1:FOR x=0 TO 149:IF sw(wi,y,x)=0 THEN NEXT:NEXT
yu=y+1
GOSUB SimulationstestII
wi=wi+3
RETURN
ssmLesen:
GOSUB SchreibLeseHilfeI
c=(meno-1)*24+2:wi=wi-3
WINDOW 9
FOR n=y TO y+19
a=n-y
FOR m=x TO x+49
b=m-x:d=a*50+b
IF cs(meno,d)<>sw(wi,n,m) THEN
cs(meno,d)=sw(wi,n,m)
PSET (2+b,c+a),cs(meno,d)*2
END IF
NEXT m
NEXT n
GOSUB SchreibLeseHilfeII
ssmSetzen:
GOSUB SchreibLeseHilfeI
GOSUB just
wi=wi-3
FOR n=y TO y+19
d=n-y
IF n>49 THEN a=n-50:ELSE a=n
FOR m=x TO x+49
e=m-x:f=d*50+e
IF m>149 THEN b=m-150:ELSE b=m
IF cs(meno,f) THEN
sw(0,a,b)=cs(meno,f)
sw(1,a,b)=cs(meno,f)
aa=a*4+1:bb=b*4+1
LINE (bb,aa)-(bb+2,aa+2),3,bf
END IF
NEXT m
NEXT n
nnbII=0:GOSUB SchreibLeseHilfeII
SchreibLeseHilfeI:
WINDOW 9
GOSUB getMENU:IF meno=7 THEN mess=1:GOTO messageFresh
WINDOW OUTPUT 10:PRINT :PRINT "choose area";
WINDOW OUTPUT 8:LOCATE 1,8:COLOR 2:PRINT "ssm frame"
WINDOW wi
WHILE (MOUSE(0)<>0):WEND
c=0:x2=0:y2=0
WHILE (c=0)
CALL ssmMouseII(x,y,c)
x1=x*4:y1=y*4
LINE (x1,y1)-(x1+200,y1+80),2,b
IF x1<>x2 OR y1<>y2 THEN LINE (x2,y2)-(x2+200,y2+80),1,b
x2=x1:y2=y1
WEND
RETURN
SchreibLeseHilfeII:
wi=wi+3
WINDOW wi
LINE (x2,y2)-(x2+200,y2+80),1,b
LINE (0,0)-(600,200),1,b
mess=1:GOTO messageFresh
scs:
ON ERROR GOTO Fehler
WINDOW CLOSE 3:WINDOW CLOSE 4
WINDOW 5,"structure construction set ",(0,15)-(401,176),16,1
wi=5:GOSUB just:GOSUB setMENU
MENU 2,3,1,"structure simulation mode "
c=0:colGitter=0:CALL Gitter(colGitter)
IF nnbI=0 THEN
FOR m=1 TO 160 STEP 8
FOR n=1 TO 400 STEP 8
IF cs(0,c) THEN LINE (n,m)-(n+6,m+6),3,bf
c=c+1
NEXT n
NEXT m
END IF
mess=5:GOTO messageFresh
Sefresh:
WINDOW OUTPUT 8:LOCATE 1,8:COLOR 2:PRINT "scs mouse"
WINDOW OUTPUT 5
c=0
checkMouse:
IF c=0 THEN MouseMenue
CALL LocateMouse(x,y)
IF x>49 OR y>19 THEN MouseMenue
c=y*50+x
IF cs(0,c)=0 THEN
cs(0,c)=1:cs(7,c)=1:col=3
ELSE
cs(0,c)=0:cs(7,c)=0:col=0
END IF
a=x*8+1:b=y*8+1
LINE (a,b)-(a+6,b+6),col,bf:nnbI=0
a=x:b=y
Halt:
c=MOUSE(0)
CALL LocateMouse(x,y)
IF a=x AND b=y AND c<>0 THEN Halt
MouseMenue:
CALL LocateMouse(x,y)
IF x>49 THEN x=49
IF y>19 THEN y=19
CALL showMouse(x,y,wi)
men=MENU(0)
meno=MENU(1)
IF men=2 THEN
ON meno GOTO SimModeI,SimModeII,ssm,suicide
ELSEIF men=4 THEN
ON meno-2 GOTO Schreiben,Lesen,Kopieren
ELSEIF men=5 THEN
ON meno GOTO PuANDSp,PuORSp,PuXORSp
ELSEIF men=6 THEN
IF meno=1 THEN Loeschen
IF meno=4 THEN Invertieren
IF meno=5 THEN Gitter
ELSEIF men=7 THEN
IF meno=1 THEN Sichern
IF meno=2 THEN Laden
IF meno=5 THEN Directory
END IF
c=MOUSE(0)
GOTO checkMouse
Fehler:
WINDOW CLOSE 11
CALL Fehleranzeige
WINDOW OUTPUT wi
RESUME Sefresh
suicide:
WINDOW OUTPUT 10:COLOR 2:PRINT
PRINT "it`s against law, at least in Germany"
PRINT "but even computers are open to corruption ..."
PRINT "I`m not begging for money, I want bits !";
b$(1)="b":b$(2)="i":b$(3)="t":b$(4)="s"
FOR n=1 TO 4
GOSUB continue
IF a$<>b$(n) THEN
PRINT :PRINT "I see, you`re honest":PRINT "ok";
mess=0:GOTO messageFresh
END IF
NEXT n
MENU RESET
SYSTEM
Lesen:
GOSUB getMENU:c=0:IF meno=7 THEN copyMarke
FOR m=1 TO 160 STEP 8
FOR n=1 TO 400 STEP 8
IF cs(0,c)<>cs(meno,c) THEN
LINE (n,m)-(n+6,m+6),cs(meno,c)*3,bf
cs(0,c)=cs(meno,c):cs(7,c)=cs(meno,c)
END IF
c=c+1
NEXT n
NEXT m
nnbI=0:GOTO copyMarke
Kopieren:
WINDOW 9
FOR n=1 TO 2
GOSUB getMENU:a(n)=meno:IF meno=7 THEN copyMarke
NEXT n:o=a(1)
GOTO SchreibenMarke
Schreiben:
GOSUB getMENU:o=0:IF meno=7 THEN copyMarke
SchreibenMarke:
WINDOW OUTPUT 9
c=0:y=(meno-1)*24+2
FOR m=0 TO 19
FOR n=0 TO 49
IF cs(o,c)<>cs(meno,c) THEN
PSET (2+n,y+m),cs(o,c)*2
cs(meno,c)=cs(o,c)
END IF
c=c+1
NEXT n
NEXT m
copyMarke:
WINDOW wi
mess=1:GOTO messageFresh
Sichern:
WINDOW 9
GOSUB getMENU:IF meno=7 THEN diskMarke
WINDOW 9
y2=95:CALL PRGRequest(f$,df$,y2):IF f$="/" THEN diskMarke
OPEN f$ FOR OUTPUT AS #1
FOR n=0 TO 999
WRITE#1,cs(meno,n)
NEXT n
CLOSE 1
GOTO diskMarke
Laden:
WINDOW 9
GOSUB getMENU:IF meno=7 THEN diskMarke
WINDOW 9
y2=95:CALL PRGRequest(f$,df$,y2):IF f$="/" THEN diskMarke
OPEN f$ FOR INPUT AS #1
FOR n=0 TO 999
INPUT#1,cs(meno,n)
NEXT n
CLOSE 1
c=0:y=(meno-1)*24+2
FOR m=0 TO 19
FOR n=0 TO 49
IF cs(meno,c)=0 THEN col=0:ELSE col=2
PSET (2+n,y+m),col
c=c+1
NEXT n
NEXT m
GOTO diskMarke
Directory:
WINDOW OUTPUT 10:PRINT :PRINT :PRINT
y2=80:CALL PRGRequest(f$,df$,y2):IF df$="" THEN diskMarke
WINDOW 11,,(20,30)-(395,236),0,1
COLOR 2:FILES df$
COLOR 3:PRINT "press any key";
GOSUB continue
WINDOW CLOSE 11
diskMarke:
WINDOW wi
mess=2:GOTO messageFresh
Loeschen:
FOR n=0 TO 999
cs(0,n)=0:cs(7,n)=0
NEXT n
LINE (1,1)-(399,159),0,bf
IF colGitter=1 THEN colGitter=0:CALL Gitter(colGitter)
nnbI=1:GOTO Sefresh
Invertieren:
me=1:GOTO LogikMarke
PuANDSp:
me=2:GOTO Logik
PuORSp:
me=3:GOTO Logik
PuXORSp:
me=4:GOTO Logik
Logik:
GOSUB getMENU:IF meno=7 THEN mess=3:GOTO messageFresh
LogikMarke:
c=0
FOR m=1 TO 160 STEP 8
FOR n=1 TO 400 STEP 8
IF me=1 THEN
cs(0,c)=ABS(cs(0,c)-1)
ELSEIF me=2 THEN
cs(0,c)=cs(0,c) AND cs(meno,c)
ELSEIF me=3 THEN
cs(0,c)=cs(0,c) OR cs(meno,c)
ELSEIF me=4 THEN
cs(0,c)=cs(0,c) XOR cs(meno,c)
END IF
LINE (n,m)-(n+6,m+6),cs(0,c)*3,bf
cs(7,c)=cs(0,c)
c=c+1
NEXT n
NEXT m
nnbI=0
IF me>1 THEN mess=3:GOTO messageFresh:ELSE GOTO Sefresh
Gitter:
CALL Gitter(colGitter)
GOTO Sefresh
SimModeII:
smod=2
SimModeI:
IF nnbI=1 THEN Simulationsende
WINDOW OUTPUT 10:COLOR 2
IF smod=2 THEN PRINT:PRINT "any key continues after signal black-orange-black";
PRINT:PRINT "stop simulation with space";
PRINT :csrl=CSRLIN:COLOR 2:PRINT "generation# 1";
WINDOW OUTPUT 5
GOSUB Simulationsinit
IF xr<xl THEN Simulationsende
an=0:na=7:ret=0:us=0:gennr=1:sgen=1
SimModeMarke:
yor=0:yur=0:xlr=0:xrr=0:yov=0:yuv=0:xlv=0:xrv=0:settest=0:a$=""
gennr=gennr+1
WINDOW OUTPUT 10:COLOR 2:LOCATE csrl,12:PRINT gennr;
WINDOW OUTPUT 5
FOR n=yo TO yu
o=n-1:IF o=-1 THEN o=19
u=n+1:IF u=20 THEN u=0
of=o*50:uf=u*50
FOR m=xl TO xr
l=m-1:IF l=-1 THEN l=49
r=m+1:IF r=50 THEN r=0
nf=n*50
a=cs(an,of+l)+cs(an,of+r)+cs(an,uf+l)+cs(an,uf+r)
a=a+cs(an,of+m)+cs(an,uf+m)+cs(an,nf+l)+cs(an,nf+r)
IF a<>2 THEN
IF a=3 THEN c=1:ELSE c=0
IF cs(an,nf+m)<>c THEN
x=m*8+1:y=n*8+1:settest=1
LINE (x,y)-(x+6,y+6),c*3,bf
END IF
ELSE
c=cs(an,nf+m)
END IF
cs(na,nf+m)=c
IF a$="" THEN a$=INKEY$
NEXT m
NEXT n
IF a$=" " OR settest=0 THEN ret=1
hyo=yo*50:hyu=yu*50
FOR xx=xl TO xr
IF cs(na,hyo+xx) THEN yor=1
IF cs(na,hyu+xx) THEN yur=1
NEXT xx
FOR yy=yo TO yu
IF cs(na,yy*50+xl) THEN xlr=1
IF cs(na,yy*50+xr) THEN xrr=1
NEXT yy
yo=yo-yor:yu=yu+yur:xl=xl-xlr:xr=xr+xrr
hyo=(yo+1)*50:hyu=(yu-1)*50
FOR xx=xl+1 TO xr-1
IF cs(na,hyo+xx) THEN yov=1
IF cs(na,hyu+xx) THEN yuv=1
NEXT xx
FOR yy=yo+1 TO yu-1
IF cs(na,yy*50+xl+1) THEN xlv=1
IF cs(na,yy*50+xr-1) THEN xrv=1
NEXT yy
GOSUB SimulationstestI
IF us THEN
IF yo=2 THEN
FOR y=yo TO yu:FOR x=xl TO xr:IF cs(0,y*50+x)=0 THEN NEXT:NEXT
yo=y-1:us=0
END IF
IF yu=18 THEN
FOR y=yu TO yo STEP -1:FOR x=xl TO xr:IF cs(0,y*50+x)=0 THEN NEXT:NEXT
yu=y+1:us=0
END IF
IF xl=1 THEN
FOR x=xl TO xr:FOR y=yo TO yu:IF cs(0,y*50+x)=0 THEN NEXT:NEXT
xl=x-1:us=0
END IF
IF xr=48 THEN
FOR x=xr TO xl STEP -1:FOR y=yo TO yu:IF cs(0,y*50+x)=0 THEN NEXT:NEXT
xr=x+1:us=0
END IF
END IF
IF ret=1 AND na=0 THEN Simulationsende
IF an=0 THEN an=7:na=0:ELSE an=0:na=7
IF smod=2 AND ret=0 THEN GOSUB stepbystep
GOTO SimModeMarke
Simulationsende:
smod=0:mess=4:GOTO messageFresh
Simulationsinit:
FOR x=0 TO 49:FOR y=0 TO 19:IF cs(0,y*50+x)=0 THEN NEXT:NEXT
xl=x-1
FOR y=0 TO 19:FOR x=0 TO 49:IF cs(0,y*50+x)=0 THEN NEXT:NEXT
yo=y-1
FOR x=49 TO 0 STEP -1:FOR y=0 TO 19:IF cs(0,y*50+x)=0 THEN NEXT:NEXT
xr=x+1
FOR y=19 TO 0 STEP -1:FOR x=0 TO 49:IF cs(0,y*50+x)=0 THEN NEXT:NEXT
yu=y+1
GOSUB SimulationstestII
RETURN
SimulationstestI:
IF yor=0 AND yov=0 THEN yo=yo+1
IF yur=0 AND yuv=0 THEN yu=yu-1
IF xlr=0 AND xlv=0 THEN xl=xl+1
IF xrr=0 AND xrv=0 THEN xr=xr-1
SimulationstestII:
IF wi=5 THEN simu=19:simr=49:ELSE simu=49:simr=149
IF yo<0 THEN yu=simu:yo=0:us=1
IF yu>simu THEN yu=simu:yo=0:us=1
IF xl<0 THEN xr=simr:xl=0:us=1
IF xr>simr THEN xr=simr:xl=0:us=1
RETURN
getMENU:
WINDOW OUTPUT 10:COLOR 2:PRINT :PRINT "choose memory (mem`s MENU)";
getMENUmarke:
men=MENU(0):IF men=0 THEN getMENUmarke
meno=MENU(1):IF men<>3 THEN getMENUmarke
IF wi=5 THEN PRINT:PRINT "just a moment ...";
WINDOW OUTPUT wi
RETURN
ColorReset:
PALETTE 0,.1,.1,1
PALETTE 1,0,0,0
PALETTE 2,1,1,1
PALETTE 3,1,.55,0
RETURN
stepbystep:
FOR m=1 TO 2
PALETTE 3,0,0,0
FOR n=1 TO 1000:NEXT n
PALETTE 3,1,.55,0
FOR n=1 TO 1000:NEXT n
NEXT m
GOSUB continue
IF a$=" " THEN ret=1:ELSE ret=0
RETURN
continue:
a$=""
WHILE (a$="")
a$=INKEY$
WEND
RETURN
messageFresh:
IF mess>0 THEN WINDOW OUTPUT 10:COLOR 2:PRINT
IF mess=1 THEN PRINT "copy terminated";
IF mess=2 THEN PRINT "disk operation terminated";
IF mess=3 THEN PRINT "logical operation terminated";
IF mess=4 THEN PRINT "simulation terminated";
IF mess=5 THEN PRINT "scs - ok";
IF mess=6 THEN PRINT "ssm - ok";
WINDOW OUTPUT wi
IF wi=5 THEN GOTO Sefresh:ELSE GOTO ssmRefresh
just:
WINDOW OUTPUT 10:COLOR 2:PRINT :PRINT "just a moment ...";
WINDOW OUTPUT wi
RETURN
setMENU:
IF wi=5 THEN nu=1:ELSE nu=0
MENU 4,1,item(nu,0):MENU 4,2,item(nu,1):MENU 4,3,item(nu,2):MENU 4,4,item(nu,3)
MENU 5,0,item(nu,4):MENU 5,1,item(nu,5):MENU 5,2,item(nu,6):MENU 5,3,item(nu,7)
MENU 6,1,item(nu,8):MENU 6,2,item(nu,9):MENU 6,3,item(nu,10):MENU 6,4,item(nu,11):MENU 6,5,item(nu,12)
MENU 7,3,item(nu,13):MENU 7,4,item(nu,14)
RETURN
catchtheMouse:
WHILE (MOUSE(0)<>0):WEND
c=0
WHILE (c=0)
CALL ssmMouse(x,y,c)
WEND
RETURN
SUB showMouse(x,y,wi) STATIC
WINDOW OUTPUT 8:COLOR 2
LOCATE 2,8:PRINT x" "
LOCATE 3,8:PRINT y" ";
WINDOW OUTPUT wi
END SUB
SUB ssmMouse(x,y,c) STATIC
c=MOUSE(0):x=INT(MOUSE(1)/4):y=INT(MOUSE(2)/4)
IF x>149 THEN x=149
IF y>49 THEN y=49
wi=3:CALL showMouse(x,y,wi)
END SUB
SUB ssmMouseII(x,y,c) STATIC
c=MOUSE(0):x=INT(MOUSE(1)/4):y=INT(MOUSE(2)/4)
IF x>100 THEN x=100
IF y>30 THEN y=30
wi=3:CALL showMouse(x,y,wi)
END SUB
SUB Gitter(colGitter) STATIC
LINE (0,0)-(400,160),1,b
IF colGitter=0 THEN colGitter=1:ELSE colGitter=0
FOR n=8 TO 392 STEP 8
LINE (n,1)-(n,159),colGitter
IF n<153 THEN LINE (1,n)-(399,n),colGitter
NEXT n
IF colGitter=1 THEN
MENU 6,5,1,"grid off "
ELSE
MENU 6,5,1,"grid on "
END IF
END SUB
SUB ssmGitter STATIC
LINE (0,0)-(600,200),1,b
FOR n=4 TO 596 STEP 4
LINE (n,1)-(n,199),1
IF n<213 THEN LINE (1,n)-(599,n),1
NEXT n
END SUB
SUB LocateMouse(x,y) STATIC
x=INT(MOUSE(1)/8):y=INT(MOUSE(2)/8)
END SUB
SUB PRGRequest(f$,df$,y2) STATIC
WINDOW 6,"prg request - name ...",(20,30)-(395,y2),0,1
LOCATE 2,2:COLOR 2,0:PRINT "enter new name or just return":PRINT
PRINT " directory name (old) : "df$
INPUT " directory name (new) : ",ff$
IF ff$<>"" AND ff$<>df$ THEN df$=ff$
IF y2=95 THEN
PRINT " file name (old) : "nf$
INPUT " file name (new) : ",ff$
IF ff$<>"" AND ff$<>nf$ THEN nf$=ff$
END IF
f$=df$+"/"+nf$
IF df$="" OR nf$="" THEN f$="/"
WINDOW CLOSE 6
END SUB
SUB Fehleranzeige STATIC
WINDOW OUTPUT 10:PRINT :PRINT "attention there`s an error"
er=ERR
IF er=53 THEN
PRINT "53 - file not found";
ELSEIF er=61 THEN
PRINT "61 - disk full";
ELSEIF er=64 THEN
PRINT "64 - bad file name";
ELSE
PRINT "error#"ERR;
END IF
END SUB